package xyz.xtt.exchange.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.extern.slf4j.Slf4j;
import xyz.xtt.common.response.ApiResult;
import xyz.xtt.exchange.dto.AssetAuditDto;
import xyz.xtt.exchange.service.ITblAssetAuditService;
import xyz.xtt.exchange.vo.AssetAuditVo;

/**
 * This is Description &#064;author gzm &#064;date 2024/10/23/
 */
@Slf4j
@Schema(name = "获取资产信息", description = "资产详细信息")
@RequestMapping("/api/exchange")
@RestController
public class AssetController {

	@Autowired
	private ITblAssetAuditService tblAssetAuditService;

//	/**
//	 * 获取用户信息
//	 */
//	@Operation(summary = "获取用户信息", description = "uid必须存在")
//	@GetMapping("/getAccount")
//	public ApiResult<UserVo> getAccountAddress(@RequestParam("uid") String uid, HttpServletRequest req) {
//		if (uid == null || uid.isBlank()) {
//			return ApiResult.build(1, "illegal arguments");
//		}
//		return ApiResult.ok(assetService.getAccountAddress(uid));
//	}

//	/**
//	 * 获取个人资产列表
//	 */
//	@Operation(summary = "获取个人资产列表", description = "uid必须存在")
//	@GetMapping("/myAssets")
//	public ApiResult<MyAssetsVo> getMyAssets(@RequestHeader("uid") String uid, Integer currPage, Integer type) {
//		return ApiResult.ok(assetService.getMyAssets(uid, currPage, type));
//	}

//	/**
//	 * 详情页
//	 * 
//	 * @param goodsId 业务商品ID
//	 * @return AssetDetailsVo
//	 */
//	@Operation(summary = "获取资产详情", description = "uid、goodsId必须存在")
//	@GetMapping("/getAssetDetails")
//	public ApiResult<AssetDetailsVo> getAssetDetails(@RequestHeader("uid") String uid, @RequestParam(value = "goodsId") String goodsId,
//			HttpServletRequest req) {
//		return ApiResult.ok(assetService.getAssetDetails(goodsId, uid));
//	}
//
//	@Operation(summary = "获取资产详情")
//	@GetMapping("/detail")
//	public ApiResult<DetailResponse> detail(@RequestHeader("uid") String uid, @RequestParam(value = "goodsId") String goodsId) {
//		log.info("/api/exchange/detail uid:{}, goodsId:{}", uid, goodsId);
//		return ApiResult.ok(assetService.detail(goodsId, uid));
//	}

	@GetMapping("/get_audit_list")
	public ApiResult<List<AssetAuditVo>> getAuditList(@RequestHeader("uid") Long uid, @RequestParam(defaultValue = "1") Integer currPage,
			@RequestParam(defaultValue = "10") Integer pageSize) {
		return ApiResult.ok(tblAssetAuditService.getAuditList(uid, currPage, pageSize));
	}

	@GetMapping("/set_audit_status")
	public ApiResult<Boolean> setAuditStatus(@RequestHeader("uid") Long uid, @RequestParam(value = "id") Long id) {
		return ApiResult.ok(tblAssetAuditService.setAssetAuditStatus(uid, id, 1));
	}

	@Operation(summary = "获取审核记录")
	@GetMapping("/asset/getAuditRecord")
	public ApiResult<AssetAuditDto> getAuditRecord(@RequestHeader("uid") Long uid, @RequestParam("auditId") Long auditId) {
		return ApiResult.ok(tblAssetAuditService.getAuditRecord(uid, auditId));
	}

//	@Operation(summary = "获取个人铸造价格配置")
//	@GetMapping("/asset/getMintPriceConfig")
//	public ApiResult<List<MintPriceConfigItem>> getPersonalMintPriceConfig(){
//		return ApiResult.ok(assetService.getPersonalMintPriceConfig());
//	}

//	@Operation(summary = "获取个人铸造价格")
//	@GetMapping("/asset/calMintPrice")
//	public ApiResult<String> calculatePersonalMintPrice(@RequestParam("mintNum") Integer mintNum){
//		return ApiResult.ok(assetService.calculatePersonalMintPrice(mintNum));
//	}

//	@Operation(summary = "获取资产最新配置及其日志")
//	@GetMapping("/asset/getAssetExpand")
//	public ApiResult<TblAssetExpandDto> getAssetExpand(@RequestParam("assetId") @NotNull Long assetId){
//		return ApiResult.ok(assetService.getAssetExpand(assetId));
//	}
}
